package com.lxl.hadoop.reverse;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;

import java.io.IOException;

/**
 * @Author lixilin
 * @Date 2022/1/9 10:08
 * @Description
 */
public class WcMapper2 extends Mapper<LongWritable, Text,Text, Text> {


    Text outKey = new Text();
    Text outVal = new Text();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        String[] words = value.toString().split("--");
        outKey.set(words[0]);
        outVal.set(words[1].replace("\t","-->"));
        context.write(outKey,outVal);
    }
}
